<template>
  <el-progress ref="compRef" v-model="value" v-bind="{ ...$props }">
    <template v-for="(_slot, slotName) in $slots" #[slotName]="slotProps">
      <slot :name="slotName" v-bind="slotProps" :key="slotName"></slot>
    </template>
  </el-progress>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { ProgressProps } from "element-plus";
import { BaseProgressExpose } from "./types";
interface Props extends Partial<ProgressProps> {}

/** 需要按照官网文档设置默认值，否则表现效果和官网文档的不一致 */
withDefaults(defineProps<Props>(), {
  percentage: 0,
  type: "line",
  strokeWidth: 6,
  duration: 3,
  width: 126,
  showText: true,
  strokeLinecap: "round",
});

const value = defineModel();
const compRef = ref();

defineExpose<BaseProgressExpose>({
  // @ts-ignore
  instance: compRef,
});
</script>
<style lang="scss"></style>
